package charts;

import graph.XYGraph;

import java.awt.BasicStroke;
import java.awt.Color;

import org.jfree.chart.axis.LogAxis;
import org.jfree.chart.axis.NumberAxis;
import org.jfree.chart.plot.XYPlot;
import org.jfree.data.xy.XYSeriesCollection;

public class DriftChart extends XYGraph{

	XYSeriesCollection dataset;
	
	public DriftChart(XYSeriesCollection dataset) {
			
		super("Rate Multipliers",new NumberAxis("second"),new NumberAxis("(Rate Multiplier-1.0)10^6"),dataset);
		this.dataset = dataset;
		
//		((LogAxis)yAxis).setBase(10);
		
		setPlotColor(new Color[] {Color.BLUE,Color.RED,Color.BLACK,Color.GREEN,Color.ORANGE});
		setPlotThickness(new float[]{1.3f,1.3f,1.3f,1.3f,1.3f});
		renderer.setBaseShapesVisible(false);
	}
	
	protected void createLegend(XYPlot plot) {
//		chart.getLegend().setBackgroundPaint(Color.LIGHT_GRAY);
//		chart.getLegend().setFrame(BlockBorder.NONE);
	}
	
	public void setDataRange(double startX, double endX, double startY, double endY){
		XYPlot plot = (XYPlot) chart.getPlot();
		plot.getDomainAxis().setRange(startX, endX);
		plot.getRangeAxis().setRange(startY, endY);
	}
	
	public void setPlotColor(Color[] colors){
		for (int j = 0; j < colors.length; j++) {
			renderer.setSeriesPaint(j, colors[j]);
		}
	}
	
	public void setPlotThickness(float[] thickness){
		for (int j = 0; j < thickness.length; j++) {
			renderer.setSeriesStroke(j, new BasicStroke(thickness[j]));
		}
	}
}
